package com.example.homeword;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
Button mBtnRegister;
EditText mEtUserName;
Spinner mSpDept;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mBtnRegister = findViewById(R.id.btn_register);
        mEtUserName  = findViewById(R.id.et_user_name);
        mSpDept = findViewById(R.id.sp_dept);
        mBtnRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
           String userName = mEtUserName.getText().toString();
           String depts = mSpDept.getSelectedItem().toString();
                Toast.makeText(MainActivity.this,userName+"="+depts, Toast.LENGTH_SHORT).show();
            }
        });
    }
}